package qlsl.androiddesign.adapter.subadapter;

import java.util.HashMap;
import java.util.List;

import com.qlsl.androiddesign.kuaiwa.R;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import qlsl.androiddesign.activity.baseactivity.BaseActivity;
import qlsl.androiddesign.adapter.baseadapter.BaseAdapter;
import qlsl.androiddesign.util.commonutil.DensityUtils;

public class RecruitReleasAdapter extends BaseAdapter<HashMap<String, Object>> {

	public RecruitReleasAdapter(BaseActivity activity,
			List<HashMap<String, Object>> list) {
		super(activity, list);
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = getItemView(convertView, R.layout.listitem_post_job);

		ViewGroup list_item = getView(convertView, R.id.list_item);
		TextView tv_xing = getView(convertView, R.id.tv_xing);
		TextView tv_text = getView(convertView, R.id.tv_text);
		TextView tv_value = getView(convertView, R.id.tv_value);
		ImageView iv_arrow = getView(convertView, R.id.iv_arrow);

		HashMap<String, Object> map = getItem(position);
		String text = (String) map.get("text");
		String value = (String) map.get("value");
		int marginTop = DensityUtils.dp2px(activity, 10);

		tv_text.setText(text);
		tv_value.setText(value);

		// ////////////////////////////////设置paddingTop/////////////////////////////////////////////////////////////////////
		LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) list_item
				.getLayoutParams();
		convertView.setActivated(true);// 当用tv_xing.getLayoutParams();的时候获取的事父布局
		if (position == getCount() - 1) {
			params.setMargins(0, marginTop, 0, 0);
			tv_xing.setVisibility(View.VISIBLE);
		} else {
			tv_xing.setVisibility(View.INVISIBLE);
			params.setMargins(0, 0, 0, 0);
		}

		return convertView;
	}
}
